package com.bookmanger.controller;

import com.bookmanger.common.result.Result;
import com.bookmanger.entity.select.UserListDto;
import com.bookmanger.entity.vo.ListForm;
import com.bookmanger.entity.vo.UserListVo;
import com.bookmanger.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *  @folder 用户管理
 */
@RestController
@RequestMapping("/userManager")
public class UserManagerController {

    @Autowired
    private UserService userService;

    /**
     * 查询用户列表
     * @param userListDto
     * @return
     */
    @PostMapping("/userList")
    public Result<ListForm<UserListVo>> getManagerList(@RequestBody UserListDto userListDto){
        return userService.getUserList(userListDto);
    }

    /**
     * 停用用户账号
     * @param id
     * @return
     */
    @GetMapping("/userDisable")
    public Result userDisable(@RequestParam Long id){
        return userService.userDisable(id);
    }

    /**
     * 启用用户账号
     * @param id
     * @return
     */
    @GetMapping("/userEnable")
    public Result userEnable(@RequestParam Long id){
        return userService.userEnable(id);
    }

    /**
     * 冻结用户账号
     * @param id
     * @return
     */
    @GetMapping("/userFreeze")
    public Result userFreeze(@RequestParam Long id){
        return userService.userFreeze(id);
    }


}
